<?php
namespace PsiFramework\Classes\Util\Security\Model;

import("Classes.Model.Object");

use \PsiFramework\Classes\Model\Object;
use PsiFramework\Classes\Util\Application;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe pour les droits
 *
 * @package Classes.Util.Security.Model
 */
class SecurityRight extends Object
{

    protected /*int*/     $_user ;
    protected /*int*/     $_role ;
    protected /*string*/  $_application ;
    protected /*string*/  $_action ;
    protected /*string*/  $_object ;
    protected /*boolean*/ $_readable ;
    protected /*boolean*/ $_writable ;
    protected /*boolean*/ $_executable ;

    public function __construct(
        /*int*/     $user=0,
        /*int*/     $role=0,
        /*string*/  $application='',
        /*string*/  $action='',
        /*string*/  $object='',
        /*boolean*/ $readable=false,
        /*boolean*/ $writable=false,
        /*boolean*/ $executable=false
    )
    {
        $this->_user = $user ;
        $this->_role = $role ;
        $this->_application = $application ;
        $this->_action = $action ;
        $this->_object = $object ;
        $this->_readable = $readable ;
        $this->_writable = $writable ;
        $this->_executable = $executable ;
    }

    public function getId()
    {
        $id = array();
        $id["user"] = $this->getUser();
        $id["role"] = $this->getRole();
        $id["application"] = $this->getApplication();
        $id["action"] = $this->getAction();
        $id["object"] = $this->getObject();
        return $id ;
    }

    public function getUser()
    {
        if (is_null($this->_user)) {
            $this->_user = 0 ;
        }
        return $this->_user ;
    }

    public function setUser(/*int*/ $user)
    {
        if (is_null($user)) {
            $user = 0 ;
        }
        $this->_user = $user ;
    }

    public function getRole()
    {
        if (is_null($this->_role)) {
            $this->_role = 0 ;
        }
        return $this->_role ;
    }

    public function setRole(/*int*/ $role)
    {
        if (is_null($role)) {
            $role = 0 ;
        }
        $this->_role = $role;
    }

    public function getApplication()
    {
        if (is_null($this->_application)) {
            $this->_application = '' ;
        }
        return $this->_application ;
    }

    public function setApplication(/*string*/ $application)
    {
        if (is_null($application)) {
            $application = '' ;
        }
        $this->_application = $application;
    }

    public function getAction()
    {
        if (is_null($this->_action)) {
            $this->_action = '' ;
        }
        return $this->_action ;
    }

    public function setAction(/*string*/ $action)
    {
        if (is_null($action)) {
            $action = '' ;
        }
        $this->_action = $action;
    }

    public function getObject()
    {
        if (is_null($this->_object)) {
            $this->_object = '' ;
        }
        return $this->_object ;
    }

    public function setObject(/*string*/ $object)
    {
        if (is_null($object)) {
            $object = '' ;
        }
        $this->_object = $object;
    }

    public function isReadable()
    {
        return $this->_readable ;
    }

    public function setReadable(/*bool*/ $readable)
    {
        $this->_readable = $readable;
    }

    public function isWritable()
    {
        return $this->_writable ;
    }

    public function setWritable(/*bool*/ $writable)
    {
        $this->_writable = $writable;
    }

    public function isExecutable()
    {
        return $this->_executable ;
    }

    public function setExecutable(/*bool*/ $executable)
    {
        $this->_executable = $executable;
    }

    public function toString()
    {

    }
}
